package com.mr.base.alpha.mappers;

import com.mr.base.alpha.dos.OrganizationDO;

import static org.apache.ibatis.jdbc.SqlBuilder.*;

public class OrganizationSqlProvider {

    public String insertSelective(OrganizationDO record) {
        BEGIN();
        INSERT_INTO("t_organization");

        if (record.getId() != null) {
            VALUES("id", "#{id,jdbcType= BIGINT}");
        }
        if (record.getCreatedId() != null) {
            VALUES("created_id", "#{createdId,jdbcType= BIGINT}");
        }
        if (record.getCreatedName() != null) {
            VALUES("created_name", "#{createdName,jdbcType= VARCHAR}");
        }
        if (record.getCreatedTime() != null) {
            VALUES("created_time", "#{createdTime,jdbcType= TIMESTAMP}");
        }
        if (record.getUpdatedId() != null) {
            VALUES("updated_id", "#{updatedId,jdbcType= BIGINT}");
        }
        if (record.getUpdatedName() != null) {
            VALUES("updated_name", "#{updatedName,jdbcType= VARCHAR}");
        }
        if (record.getUpdatedTime() != null) {
            VALUES("updated_time", "#{updatedTime,jdbcType= TIMESTAMP}");
        }
        if (record.getStatus() != null) {
            VALUES("status", "#{status,jdbcType= INTEGER}");
        }
        if (record.getOrganizationName() != null) {
            VALUES("organization_name", "#{organizationName,jdbcType= VARCHAR}");
        }
        if (record.getLevel() != null) {
            VALUES("level", "#{level,jdbcType= INTEGER}");
        }
        if (record.getParentid() != null) {
            VALUES("parentId", "#{parentid,jdbcType= BIGINT}");
        }
        return SQL();
    }

    public String updateByPrimaryKeySelective(OrganizationDO record) {
        BEGIN();
        UPDATE("t_organization");
        if (record.getCreatedId() != null) {
            SET("created_id = #{createdId,jdbcType=BIGINT}");
        }
        if (record.getCreatedName() != null) {
            SET("created_name = #{createdName,jdbcType=VARCHAR}");
        }
        if (record.getCreatedTime() != null) {
            SET("created_time = #{createdTime,jdbcType=TIMESTAMP}");
        }
        if (record.getUpdatedId() != null) {
            SET("updated_id = #{updatedId,jdbcType=BIGINT}");
        }
        if (record.getUpdatedName() != null) {
            SET("updated_name = #{updatedName,jdbcType=VARCHAR}");
        }
        if (record.getUpdatedTime() != null) {
            SET("updated_time = #{updatedTime,jdbcType=TIMESTAMP}");
        }
        if (record.getStatus() != null) {
            SET("status = #{status,jdbcType=INTEGER}");
        }
        if (record.getOrganizationName() != null) {
            SET("organization_name = #{organizationName,jdbcType=VARCHAR}");
        }
        if (record.getLevel() != null) {
            SET("level = #{level,jdbcType=INTEGER}");
        }
        if (record.getParentid() != null) {
            SET("parentId = #{parentid,jdbcType=BIGINT}");
        }
        WHERE("id = #{id,jdbcType=BIGINT}");
        return SQL();
    }

}
    

